# 1.装饰器的定义以及基本使用
# def welcome(fn):
#     def wrap(*args,**kargs):
#         print('welcome')
#         res = fn(*args,**kargs)
#         return res
#     return wrap
# @welcome
# def fn1(msg):
#     print(f'fn1-{msg}')
#
# @welcome
# def fn2(msg):
#     print(f'fn2-{msg}')
#
# fn1('胖胖龙')
# fn2('小小')

# 2.通过对装饰器函数进行嵌套，完成在装饰器上进行传参的需求
def welcome(outMessage):
    print(outMessage)
    def outwrap(fn):
        def wrap(*args,**kargs):
            print('welcome')
            res = fn(*args,**kargs)
            return res
        return wrap
    return outwrap
@welcome('是outmessage')
def fn1(msg):
    print(f'fn1-{msg}')

@welcome('out-message-2')
def fn2(msg):
    print(f'fn2-{msg}')

fn1('胖胖龙')
fn2('小小')